Skip to content

Pin pytest <9.2 to fix CI breakage with pytest-benchmark 4.x - #878

Merged
pablomartinezbernardo merged 1 commit into
DataDog:mainfrom
gnufede:pin-pytest
Oct 28, 2026
Merged

pablomartinezbernardo merged 1 commit into
DataDog:mainfrom
gnufede:pin-pytest

Conversation

@gnufede

@gnufede gnufede commented Oct 28, 2026 •

Copy link
Copy Markdown
Member

What does this PR do?

Caps pytest at <9.2 for Python >= 3.10 in pyproject.toml and regenerates poetry.lock (content-hash only).

pytest 9.2.0 removed the private Node._nodeid attribute, which pytest_benchmark/fixture.py (BenchmarkFixture.__init__) relies on. As a result, every test using the benchmark fixture fails with:

AttributeError: 'Function' object has no attribute '_nodeid'. Did you mean: 'nodeid'?

CI installs dev dependencies with pip install .[dev] (.github/workflows/build.yml and tests/Dockerfile), so the previous ^9.0.3 constraint picked up the newly released pytest 9.2.0 and broke the build.

Motivation

CI broke with the release of pytest 9.2.0 (incompatibility with pytest-benchmark 4.x, the version range this repo pins).

Why cap pytest instead of upgrading pytest-benchmark:

  • pytest-benchmark 5.x fixes this but requires Python >= 3.9, while this repo still supports Python 3.8 (which uses pytest ^8.3.4).
  • Capping pytest is the minimal change that keeps all supported Python versions (3.8–3.14) green.

Testing Guidelines

  • Confirmed pip install .[dev] now resolves to pytest 9.1.1 + pytest-benchmark 4.0.0.
  • Ran pytest tests/test_benchmarks.py on Python 3.13 with those versions: 217 passed (including the previously failing test_trigger_extract_trigger_tags[sqs-batch]).
  • poetry check passes; poetry.lock regenerated with Poetry 2.2.1 (only the content-hash changed, pytest stays at 9.0.3).

Additional Notes

Upstream tracking issue (still open): ionelmc/pytest-benchmark#321

The <9.2 cap can be removed once pytest-benchmark ships a release compatible with both pytest 9.2+ and Python 3.8, or once Python 3.8 support is dropped.

Types of Changes

  • Bug fix
  • New feature
  • Breaking change
  • Misc (docs, refactoring, dependency upgrade, etc.)

Check all that apply

  • This PR's description is comprehensive
  • This PR contains breaking changes that are documented in the description
  • This PR introduces new APIs or parameters that are documented and unlikely to change in the foreseeable future
  • This PR impacts documentation, and it has been updated (or a ticket has been logged)
  • This PR's changes are covered by the automated tests
  • This PR collects user input/sensitive content into Datadog
  • This PR passes the integration tests (ask a Datadog member to run the tests)

pytest 9.2.0 removed the private Node._nodeid attribute, which
pytest_benchmark/fixture.py (BenchmarkFixture.__init__) relies on,
causing every benchmark-fixture test to fail with AttributeError.

pytest-benchmark 5.x would fix this but requires Python >=3.9, and this
repo still supports 3.8, so cap pytest at <9.2 on the 9.x line instead
(3.8/3.9 already use pytest ^8.3.4, which is unaffected).

TODO: remove the cap once pytest-benchmark ships a fix compatible with
both pytest 9.2+ and Python 3.8, or once 3.8 support is dropped.
@gnufede gnufede changed the title Pin pytest <9.2 for python >=3.10 to fix pytest-benchmark 4.x breakage Pin pytest <9.2 to fix CI breakage with pytest-benchmark 4.x Oct 28, 2026
@gnufede
gnufede marked this pull request as ready for review October 28, 2026 09:03
@gnufede
gnufede requested review from a team as code owners October 28, 2026 09:04

@datadog-datadog-prod-us1-2 datadog-datadog-prod-us1-2 Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bits Code Review: PASS

More details

The pytest upper bound excludes 9.2+ while preserving the existing Python-version split and compatible locked versions. The updated lockfile passes Poetry’s consistency check.

Was this helpful? React 👍 or 👎

Open Bits AI session

🤖 Bits Code Review · Commit 0eb22ce

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants